package com.aids_malaria.http.response;

import android.arch.persistence.room.Embedded;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import android.support.annotation.NonNull;

import com.aids_malaria.http.request.TokenDrug;
import com.aids_malaria.util.GsonUtil;
import com.litesuits.orm.db.annotation.NotNull;
import com.litesuits.orm.db.enums.AssignType;

import java.io.Serializable;

@Entity(tableName = "premedicalTreatmentPack",primaryKeys = {"identity_code","record_seq"})
public class PremedicalTreatmentPack implements Serializable {

//    @PrimaryKey(AssignType.BY_MYSELF)
    @NonNull
    private String identity_code;
    private int record_seq;
    private String malaria_time; // 患疟疾时间
    @Embedded
    private TokenDrug taken_drags; // 服用药物
    private String taken_drags_json; // 服用药物
    private String taken_days; // 使用药物天数
    private String is_root_therapy; // 上次是否休根治疗
    private String investor;
    private String create_time;
    private String update_time;
    private String invest_time;

    private boolean createOrUpdate;

    public boolean isCreateOrUpdate() {
        return createOrUpdate;
    }

    public void setCreateOrUpdate(boolean createOrUpdate) {
        this.createOrUpdate = createOrUpdate;
    }

   public static PremedicalTreatmentPack copyFromNoPack(PremedicalTreatment premedicalTreatment){
        PremedicalTreatmentPack premedicalTreatmentPack = new PremedicalTreatmentPack();
        premedicalTreatmentPack.setIdentity_code(premedicalTreatment.getIdentity_code());
        premedicalTreatmentPack.setRecord_seq(premedicalTreatment.getRecord_seq());
        premedicalTreatmentPack.setMalaria_time(premedicalTreatment.getMalaria_time());
        premedicalTreatmentPack.setTaken_days(premedicalTreatment.getTaken_days());
        premedicalTreatmentPack.setIs_root_therapy(premedicalTreatment.getIs_root_therapy());
        premedicalTreatmentPack.setInvestor(premedicalTreatment.getInvestor());
        premedicalTreatmentPack.setCreate_time(premedicalTreatment.getCreate_time());
        premedicalTreatmentPack.setUpdate_time(premedicalTreatment.getUpdate_time());
        premedicalTreatmentPack.setInvest_time(premedicalTreatment.getInvest_time());
        String taken_drags = premedicalTreatment.getTaken_drags();
        premedicalTreatmentPack.setTaken_drags_json(taken_drags);
        TokenDrug tokenDrug = GsonUtil.gsonToBean(taken_drags, TokenDrug.class);
        premedicalTreatmentPack.setTaken_drags(tokenDrug);

        return premedicalTreatmentPack;
    }

    private int busy_type;

    public int getBusy_type() {
        return busy_type;
    }

    public void setBusy_type(int busy_type) {
        this.busy_type = busy_type;
    }

    public String getTaken_drags_json() {
        return taken_drags_json;
    }

    public void setTaken_drags_json(String taken_drags_json) {
        this.taken_drags_json = taken_drags_json;
    }

    public String getIdentity_code() {
        return identity_code;
    }

    public void setIdentity_code(String identity_code) {
        this.identity_code = identity_code;
    }

    public int getRecord_seq() {
        return record_seq;
    }

    public void setRecord_seq(int record_seq) {
        this.record_seq = record_seq;
    }

    public String getMalaria_time() {
        return malaria_time;
    }

    public void setMalaria_time(String malaria_time) {
        this.malaria_time = malaria_time;
    }

    public TokenDrug getTaken_drags() {
        return taken_drags;
    }

    public void setTaken_drags(TokenDrug taken_drags) {
        this.taken_drags = taken_drags;
    }

    public String getTaken_days() {
        return taken_days;
    }

    public void setTaken_days(String taken_days) {
        this.taken_days = taken_days;
    }

    public String getIs_root_therapy() {
        return is_root_therapy;
    }

    public void setIs_root_therapy(String is_root_therapy) {
        this.is_root_therapy = is_root_therapy;
    }

    public String getInvestor() {
        return investor;
    }

    public void setInvestor(String investor) {
        this.investor = investor;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public String getInvest_time() {
        return invest_time;
    }

    public void setInvest_time(String invest_time) {
        this.invest_time = invest_time;
    }

    @Override
    public String toString() {
        return "PremedicalTreatmentPack{" +
                "identity_code='" + identity_code + '\'' +
                ", record_seq=" + record_seq +
                ", malaria_time='" + malaria_time + '\'' +
                ", taken_drags=" + taken_drags +
                ", taken_days='" + taken_days + '\'' +
                ", is_root_therapy='" + is_root_therapy + '\'' +
                ", investor='" + investor + '\'' +
                ", create_time='" + create_time + '\'' +
                ", update_time='" + update_time + '\'' +
                ", invest_time='" + invest_time + '\'' +
                '}';
    }

}
